<template>
    <div>
        <el-form :model="physicalCardSuccess" label-width="120px">
            <el-row>
                <el-col :span="20" :offset="3" class="text_center">
                    <div class="text_center width30">
                        <el-form-item label="交易结果:" class="text_fl">
                            <span class="el-form-item-span">交易成功</span>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="20" :offset="3">
                    <div class="text_center width30">
                        <el-form-item label="新卡卡号:" class="text_fl">
                            <el-input
                                :disabled="true"
                                v-model="physicalCardSuccess.body.appBody.CARDNBRNEW"
                            ></el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="20" :offset="3">
                    <div class="text_center width30">
                        <el-form-item label="费用金额:" class="text_fl">
                            <el-input
                                :disabled="true"
                                v-model="physicalCardSuccess.body.appBody.FEECRP"
                            ></el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="20" :offset="3">
                    <div class="text_center width30">
                        <el-form-item label="寄送地址:" class="text_fl">
                            <span class="el-form-item-span">{{CARDTO_Value|cardto}}</span>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="20" :offset="3">
                    <div class="text_center width30">
                        <!-- 3001的账面余额 -->
                        <el-form-item label="账户欠款金额:" class="text_fl">
                            <el-input :disabled="true" v-model="BALNCE_value"></el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <!-- <el-row>
                <el-col :span="22"  >
                    <div
                        class="text_center width30"
                    >卡片 {{physicalCardSuccess.CARDNBR}} {{successTextVal}}</div>
                </el-col>
            </el-row>-->
            <div class="text_center">
                <el-button
                    type="primary"
                    size="small"
                    @click="handleClose"
                    icon="el-icon-circle-check"
                >确定</el-button>
                <el-button type="primary" size="small" @click="handleClickbtn">修改记录查询</el-button>
                <el-button size="small" @click.native="handleClose">关闭</el-button>
            </div>
        </el-form>
    </div>
</template>

<script>
import { mapGetters } from 'vuex';
import { closePage, getBusinessMenuId } from '@/utils/Common';

export default {
    name: 'PhysicalCardItem',
    props: {
        physicalCardSuccess: {
            type: Object,
        },
        CARDTO_Value: {
            type: String,
        }
    },
    data() {
        return {
            successTextVal: '',
            addressInfo: '',
            BALNCE_value: '',
            MenuId: '',
        };
    },
    filters: {
        cardto: (value) => {
            value = (`${value}`).trim();
            if (value === 'B') return '公司地址';
            if (value === 'H') {
                return '家庭地址';
            }
            return value;
        },
    },
    computed: {
        ...mapGetters([
            'cardAccountInfo_3001',
            'customerAdressInfo_3003',
            'businessMenu',
        ]),
    },
    mounted() {
        //this.successTextVal = this.successText();
        this.BALNCE_value = this.cardAccountInfo_3001.BALNCE;
    },
    methods: {
        // 根据地址类型 拼接详细的地址
        getAddressInfo(val) {
            switch (val) {
                case this.customerAdressInfo_3003.ADD2TYPE://公司地址
                    this.addressInfo = (this.customerAdressInfo_3003.ADD21 + '').trim() + (this.customerAdressInfo_3003.ADD22 + '').trim() + (this.customerAdressInfo_3003.ADD23 + '').trim() + (this.customerAdressInfo_3003.ADD24 + '').trim();
                    break;
                case this.customerAdressInfo_3003.ADD3TYPE: //户籍
                    this.addressInfo = (this.customerAdressInfo_3003.ADD31 + '').trim() + (this.customerAdressInfo_3003.ADD32 + '').trim() + (this.customerAdressInfo_3003.ADD33 + '').trim() + (this.customerAdressInfo_3003.ADD34 + '').trim();
                    break;
                case this.customerAdressInfo_3003.ADD1TYPE://家庭
                    this.addressInfo = (this.customerAdressInfo_3003.ADD11 + '').trim() + (this.customerAdressInfo_3003.ADD12 + '').trim() + (this.customerAdressInfo_3003.ADD13 + '').trim() + (this.customerAdressInfo_3003.ADD14 + '').trim();
                    break;
                case this.customerAdressInfo_3003.ADD4TYPE://房产
                    this.addressInfo = (this.customerAdressInfo_3003.ADD41 + '').trim() + (this.customerAdressInfo_3003.ADD42 + '').trim() + (this.customerAdressInfo_3003.ADD43 + '').trim() + (this.customerAdressInfo_3003.ADD44 + '').trim();
                    break;
                case 'O'://其他
                    this.addressInfo = (this.customerAdressInfo_3003.RTNADD41 + '').trim() ? ((this.customerAdressInfo_3003.RTNADD41 + '').trim() + (this.customerAdressInfo_3003.RTNADD42 + '').trim() + (this.customerAdressInfo_3003.RTNADD43 + '').trim() + (this.customerAdressInfo_3003.RTNADD44 + '').trim()) : ((this.customerAdressInfo_3003.RTNADD4TYPE + '').trim() ? (this.customerAdressInfo_3003.RTNADD4TYPE + '').trim() : '');
                    break;
                default:
                    this.addressInfo = '';
            }
        },

        // 点击关闭
        handleClose() {
            closePage(this.$route, this, 1);
        },
        // successText() {
        //     if (this.physicalCardSuccess.sysHead.rspDesc == this.physicalCardSuccess.rspMsg) {
        //         return this.physicalCardSuccess.sysHead.rspDesc;
        //     } else {
        //         return `${this.physicalCardSuccess.sysHead.rspDesc} ${this.formDataInfo.rspMsg}`;
        //     }
        // },
        handleClickbtn() {
            this.MenuId = getBusinessMenuId('/businessSystem/accountCardDetaileQuery', this.businessMenu);
            console.log('this.MenuId____', this.MenuId);
            this.$router.push({ name: 'accountCardDetaileQuery', path: '/businessSystem/accountCardDetaileQuery', params: { id: this.MenuId } });
        }
    },
};
</script>

<style lang='scss'>
</style>
